cmake_minimum_required(VERSION 3.16)

project(ProjectWithQT)

# # C++并行编译
if(MSVC)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()

# # Release版本生成调试符号
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /debug")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /debug")

# # 控制VS工程生成使用"文件夹"组织结构
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# 统一动态库输出位置
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIG>")
endif()

# # 调试用,输出gcmp目录及gdmp目录
include(CMakePrintHelpers)
cmake_print_variables(CMAKE_CURRENT_SOURCE_DIR)
cmake_print_variables(GCMPSDK_DIR)

# #使用环境变量中的QTDIR_X64/QTDIR设置来查找对应的Qt库
if(DEFINED ENV{QTDIR_X64})
    list(APPEND CMAKE_PREFIX_PATH $ENV{QTDIR_X64})
    cmake_print_variables(CMAKE_PREFIX_PATH)
elseif(DEFINED ENV{QTDIR})
    list(APPEND CMAKE_PREFIX_PATH $ENV{QTDIR})
    cmake_print_variables(CMAKE_PREFIX_PATH)
else()
    message(FATAL_ERROR "Cann't find Qt!")
endif()

set(ThirdParty ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty)
set(ThirdParty_pugixml_Include ${ThirdParty}/pugixml/include)

add_subdirectory(Framework)
add_subdirectory(Framework/UIPlatform)
add_subdirectory(Framework/Application)
add_subdirectory(Framework/UIComponent)
add_subdirectory(Samples/WallModule)
add_subdirectory(Samples/TaggingWall)
add_subdirectory(Samples/MeshBoolean)

# #设置启动程序
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})

# #设置Debug与Release构建目标
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
